<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>系统安装－{:config('site.name')}</title>
<link href="{$rootUrl}/static/bootstrap/5.3.2/css/bootstrap.min.css?{:config('app.app_version')}" rel="stylesheet">
<script src="{$rootUrl}/static/bootstrap/5.3.2/js/bootstrap.bundle.min.js?{:config('app.app_version')}"></script>
<style>
body {
    font-family: "Tahoma", "Microsoft Yahei", "Arial", "宋体";
    font-size: 0.9rem;
}
.card{
    width: 480px;
}
</style>
</head>
<body>
<main class="position-absolute top-50 start-50 translate-middle">
  {if !$workWrite}
  <div class="alert alert-danger" role="alert">
    数据库配置文件（config/database.php）没有写入权限！
  </div>
  {/if}
  {if !$workFunction}
  <div class="alert alert-danger" role="alert">
    <strong class="me-1">mysqli_connect</strong>函数已被禁用，请先开启！
  </div>
  {/if}
  <div class="card">
    <div class="card-header text-center fw-bold">安装{:config('site.name')}</div>
    <form class="card-body pb-0" action="{:url('share/install/save')}" method="post">
      <div class="mb-3 row">
        <label class="col-sm-3 col-form-label" for="mysql_hostname">数据库IP</label>
        <div class="col-sm-9">
          <input type="text" class="form-control" name="mysql_hostname" id="mysql_hostname" value="127.0.0.1" autocomplete="off" required>
        </div>
      </div>
      <div class="mb-3 row">
        <label class="col-sm-3 col-form-label" for="mysql_database">数据库名称</label>
        <div class="col-sm-9">
          <input type="text" class="form-control" name="mysql_database" id="mysql_database" value="douyin" autocomplete="off" required>
        </div>
      </div>
      <div class="mb-3 row">
        <label class="col-sm-3 col-form-label" for="mysql_username">数据库用户</label>
        <div class="col-sm-9">
          <input type="text" class="form-control" name="mysql_username" id="mysql_username" autocomplete="off" required>
        </div>
      </div>
      <div class="mb-3 row">
        <label class="col-sm-3 col-form-label" for="mysql_password">数据库密码</label>
        <div class="col-sm-9">
          <input type="text" class="form-control" name="mysql_password" id="mysql_password" autocomplete="off" required>
        </div>
      </div>
      <div class="mb-3 row">
        <label class="col-sm-3 col-form-label" for="mysql_port">数据库端口</label>
        <div class="col-sm-9">
          <input type="text" class="form-control" name="mysql_port" id="mysql_port" value="3306" autocomplete="off" required>
        </div>
      </div>
      <div class="mb-3 row">
        <label class="col-sm-3 col-form-label" for="mysql_prefix">数据表前缀</label>
        <div class="col-sm-9">
          <input type="text" class="form-control" name="mysql_prefix" id="mysql_prefix" value="dc_" autocomplete="off" required>
        </div>
      </div>
      <div class="mb-3 text-center">
        {if $install}
        <button class="btn btn-dark btn-sm px-3" type="submit">安装</button>
        {else/}
        <button class="btn btn-dark btn-sm px-3" type="submit" disabled>安装</button>
        {/if}
      </div>
    </form>
  </div>
</main>
</body>
</html>